package com.clayecloud.common.admin.controller;

import com.clayecloud.common.admin.services.VisitorService;
import com.clayecloud.common.entity.Visitor;
import com.clayecloud.common.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/admin/visitor")
@Api(tags = "访问记录申请")
public class AdminVisitorController {

    @Resource
    private VisitorService visitorService;

    @GetMapping("/selectAll")
    @ApiOperation("查询所有的访问记录")
    public MessageUtil selectAll(Integer size, Integer page){
        return visitorService.selectAll(size, page);
    }

    @PutMapping("/update")
    @ApiOperation("更新访问记录")
    public MessageUtil updateVisitor(Visitor visitor){
        return visitorService.updateByPrimaryKeySelective(visitor);
    }
}
